package com.itheima.social.securitys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.itheima.social.securitys.mapper.CityPaymentItemMapper;
import com.itheima.social.securitys.pojo.CityPaymentItem;
import com.itheima.social.securitys.service.PaymentItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * @author qiankaofei
 * @version 1.0
 * @date 2020/12/6 17:58
 */
@Service
public class PaymentItemServiceImpl implements PaymentItemService {

    @Autowired
    private CityPaymentItemMapper cityPaymentItemMapper;


    /**
     *     根据城市id查询参保城市的参保项目
     */
    @Override
    public List<CityPaymentItem> findCityPaymentItemListByCityId(String cityId) {
        QueryWrapper<CityPaymentItem> queryWrapper=new QueryWrapper<CityPaymentItem>();
        queryWrapper.eq("city_id",cityId);
        List<CityPaymentItem> cityPaymentItemList = cityPaymentItemMapper.selectList(queryWrapper);
        if(CollectionUtils.isEmpty(cityPaymentItemList)){
            return null;
        }
        return cityPaymentItemList;
    }
}
